define(function () {
    var self;
    var fwhf, fwhfItem;//获取传的参数

    function fwhf_info() {
        self = this;
        self._data = {
            pj: [],
            MMRN005: '',//反馈
            MMRN007: '1',//匿名否
            MMRN008: '',//回访对象
            MMRN009: ''//联系方式
        };
        self.init();
    }

    //获取评价类型和星数
    fwhf_info.prototype.getStarData = function () {
        app.ajax({
            xurl: "api/wx/fwpj/getFwpjList",
            xdata: {
                MMRK001: fwhfItem.MMRDDOCNO,
                MMRK002: fwhfItem.MMRDSEQ,
                MMRJ002: '3'
            },
            cb: function (result) {
                if (result.ok) {
                    self._data.pj.pushArray(result.data.data);
                }
            }
        });
    };

    fwhf_info.prototype.initVue = function () {
        new Vue({
            el: doc.getElementById('content'),
            data: {
                item: fwhfItem,d: self._data
            },
            methods: {
                pjChange: function (item, v) {
                    item.MMRK004 = v;
                }
            }
        });

    };

    fwhf_info.prototype.init = function () {

        fwhf = app.pageParameters['fwhf-info'];
        fwhfItem = fwhf.item;//获取传的参数

        self.getStarData();


        mui.ready(function () {
            self.initVue();
            app.taps.call(win, [
                {
                    o: 'submitDiv',
                    cb: function () {
                        app.ajax({
                            xurl: "api/wx/fwhf/saveFwhf",
                            loading: true,
                            xdata: {
                                obj: app.jsonString(self._data),
                                MMRDDOCNO: fwhfItem.MMRDDOCNO,
                                MMRDSEQ: fwhfItem.MMRDSEQ
                            },
                            cb: function (result) {
                                if (result.ok) {
                                    app.alert({
                                        msg: "回访数据提交成功!",
                                        ok: function () {
                                            setTimeout(function () {
                                                mui.back();
                                            }, 300);
                                        }
                                    });
                                    fwhf.cb();
                                } else {
                                    app.toast(result.data.message);
                                }
                            }
                        });

                    },
                    confirm: {
                        msg: "是否提交回访结果？"
                    }
                }
            ]);

        });
        mui('.mui-scroll-wrapper').scroll({
            deceleration: 0.0005 //flick 减速系数，系数越大，滚动速度越慢，滚动距离越小，默认值0.0006
        });

    };

    return new fwhf_info();
});